<?php


class EmployeesServer {
	public function pagingBySearch($where="",$order='',$numberEachPage = 10){
		$count = HttpDaoManager::getEmployeesDao()->searchNumber($where);
		$page = new Page($count, $numberEachPage);
		$limit[0]= $page->which;
		$limit[1]=$numberEachPage;
		$list = HttpDaoManager::getEmployeesDao()->searchList($where,$order, $limit);
		$page1= $page->returnPage("?".ClassManager::getToos()->combinationGet('page')."&page=");
		$data['list'] =$list;
		$data['page'] = $page1;
		return $data;
	}
	public function add($data){
		$data['entry_time'] = strtotime($data['entry_time']);
		$data['add_time'] =  strtotime("now");
		HttpDaoManager::getEmployeesDao()->add($data);
	}
	public function update($data,$id){
		$data['entry_time'] = strtotime($data['entry_time']);
		HttpDaoManager::getEmployeesDao()->update($data, $id);
		if ($data['status'] == 2){
			HttpServerManager::getAdminServer()->updateStatus($id);
		}
	}
	public function deleteBatchByid($id){
		if (is_array($id)){
			$id = implode(',',$id);
		}
		HttpDaoManager::getEmployeesDao()->deleteBatchByid($id);
	}
}

?>